/**
 * 
 */
package com.demo.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;


import com.demo.bean.City;
import com.demo.bean.User;
import com.demo.service.PositionService;

/**
 * @author Issac
 *
 */
@Controller
@RequestMapping("/city")
public class PositionController {
	
	@Autowired
	private PositionService positionService;
	
	public PositionService getPositionService() {
		return positionService;
	}

	public void setPositionService(PositionService positionService) {
		this.positionService = positionService;
	}



	@RequestMapping(value="/list", method = RequestMethod.GET)
	public ModelAndView list(){
		List<City> cityList = positionService.list();
		return new ModelAndView("cityList", "cityList", cityList);
	}
	
	@RequestMapping(value="/viewcity", method = RequestMethod.GET)
	public ModelAndView viewCity(HttpServletRequest request, String c){
		request.getSession().setAttribute("cityCode", c);
		return new ModelAndView("searchIndex");
	}
	
	
}
